$(function () {
    var flag=0; //删除键的效果切换 0为初始值
    // var contentChooseFlag=0; //内容模块来回切换是否选中
    var myDate= new Date();
    var startYear=myDate.getFullYear()-50;//起始年份
    var endYear=myDate.getFullYear()+50;//结束年份
    var yearSelect=document.getElementById('choseYear_projectManage');
    for (var i=startYear;i<=endYear;i++)
    {
        var option=document.createElement("option");
        option.text=" "+i+'年';
        try{
            // 对于更早的版本IE8
            yearSelect.add(option,yearSelect.options[null]);
        }catch (e){
            yearSelect.add(option,null);
        }
        // yearSelect.options.add(new Option(i,i)+'年');
    }
    yearSelect.options[yearSelect.options.length-51].selected=1;

    //标签页切换操作
    var tab=document.getElementsByClassName('tabNavigation')[0];
    EventUtil.addHandler(tab,"click",function (event) {
        event=EventUtil.getEvent(event);
        var target=EventUtil.getTarget(event);
        // console.log($('.projectALLContent').hasClass('active'))
        switch (target.id){
            case "itemAll":
                if(!$(target).parent().hasClass('active')){
                    $(target).parent().siblings().removeClass('active');
                    $(target).parent().addClass('active');
                }
                if(!$('.projectALLContent').hasClass('active')){
                    $('.projectALLContent').addClass('active');
                    $('.projectALLContent').siblings().removeClass('active');
                }
                break;
            case "itemEstablished":
                // console.log(1)
                // console.log($(target).parent())
                if(!$(target).parent().hasClass('active')){
                    $(target).parent().siblings().removeClass('active');
                    $(target).parent().addClass('active');
                }
                if(!$('.projectEstablishedContent').hasClass('active')){
                    $('.projectEstablishedContent').addClass('active');
                    $('.projectEstablishedContent').siblings().removeClass('active');
                }
                break;
            case "itemFinished":
                if(!$(target).parent().hasClass('active')){
                    // console.log(1)
                    // console.log($(target).parent());
                    $(target).parent().siblings().removeClass('active');
                    $(target).parent().addClass('active');
                    // console.log($(target).parent());
                }
                if(!$('.projectFinishedContent').hasClass('active')){
                    $('.projectFinishedContent').addClass('active');
                    $('.projectFinishedContent').siblings().removeClass('active');
                }
                break;
        }
    })

    //不同状态对应的操作,遍历ul的li

    // console.log($('.menuBottomStatus.statusOne').hasClass('active'))
    //1.项目未完成
    if($('.menuBottomStatus.statusOne').hasClass('active')){
        console.log(1)
        $('.menuBottomStatus.statusOne.active').parents('.partContent').siblings('.shadePane').addClass('active');
    }
    //2.取消验收
    if($('.menuBottomStatus.statusTwo').hasClass('active')){
        var link=$('.statusTwo.active>.cancelAccept>a')[0];
       
        
        
        EventUtil.addHandler(link,'click',function (event) {
            event.preventDefault();
          
            let pro_id = $(link).attr('data-id')
          
            $.ajax({
                url:'http://he.youledi.cn/Admin/ProCheck/canelCheck',
                type:'post',
                data:{id:pro_id},
                success:function(data){
                    if(data.code==1){
                        $('.menuBottomStatus.statusTwo.active').removeClass('active').siblings('.statusThree').addClass('active');
                    }
                }
            })
            // console.log($('.menuBottomStatus.statusTwo').removeClass('active').previousSibling())
        
            // $('.menuBottomStatus.statusTwo').removeClass('active').previousSibling().addClass('active');
        })
    }
    //3.点击验收

})